# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-safeurl
pkgname=('python2-safeurl' 'python-safeurl')
_pkgname=safeurl
pkgver=0.0.7
_pyver=3.13
pkgrel=12
pkgdesc='Link analyzer on Python'
arch=('any')
url='https://pypi.org/project/safeurl/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('db63ca9e08d4799cd9685c4bd152240e77a6d95f6d2448d58f3bd5d980a5b72e9baa7438fb1131967562bcb2952324e62bdebfc8e150981563703fea0564e3c2')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-safeurl() {
  depends=('python2' 'python2-requests' 'python2-coverage' 'python2-coveralls')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build

  rm -rf "$pkgdir/usr/lib/python2.7/site-packages/tests"
}

package_python-safeurl() {
  depends=('python' 'python-requests' 'python-coverage' 'python-coveralls')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build

  rm -rf "$pkgdir/usr/lib/python$_pyver/site-packages/tests"
}

